package rs.belex.belexdroid.accessor.webservicex;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import rs.belex.belexdroid.accessor.InvalidBackendResponse;
import rs.belex.belexdroid.accessor.StockQuoteAccessor;
import rs.belex.belexdroid.beans.interfaces.StockQuote;
import rs.belex.belexdroid.services.impl.ksoap2.StockQuoteServiceKsoap2Impl;
import rs.belex.belexdroid.services.interfaces.IStockQuoteService;

public class StockQuoteAccessorImpl implements StockQuoteAccessor {

	IStockQuoteService service = new StockQuoteServiceKsoap2Impl();

	public StockQuote[] getStockQuote(String[] symbols)
			throws InvalidBackendResponse {

		List<StockQuote> stockQuotes = new ArrayList<StockQuote>();
		
		stockQuotes = service.getStockQuotes(Arrays.asList(symbols));
		
		return (StockQuote[]) stockQuotes.toArray(new StockQuote[stockQuotes.size()]);
	}

	/** Actual implementation of service requests */
	@SuppressWarnings("unused")
	private StockQuote getStockQuote(String symbol) {

		StockQuote stockQuote = service.getStockQuote(symbol);

		return stockQuote;
	}
}
